package com.bookstore.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
/*
    用户类  存放了用户信息
    用于登录验证  权限验证
 */
public class User {
    private Integer uid; //用户id
    private String name; //姓名
    private String username; //用户名
    private String password;//密码
    private Integer sex;//0 男，1 女
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern  = "yyyy-MM-dd",timezone = "GMT+8")
    private Date birthday;//出生日期
    private String phone;//电话号码
    private String headPortrait;//头像
    private String email;//邮箱
    private String code;//账户激活码
    private Integer status;//用户状态,0是未激活，1是可用，2是被禁用
    private Integer uType;//用户类别0 VIP用户,1 商家,2 系统管理员

    public User() {
    }

    public User(Integer uid, String name, String username,
                String password, Integer sex, Date birthday, String phone, String headPortrait,
                String email, String code, Integer status, Integer uType) {
        this.uid = uid;
        this.name = name;
        this.username = username;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.phone = phone;
        this.headPortrait = headPortrait;
        this.email = email;
        this.code = code;
        this.status = status;
        this.uType = uType;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getHeadPortrait() {
        return headPortrait;
    }

    public void setHeadPortrait(String headPortrait) {
        this.headPortrait = headPortrait;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getuType() {
        return uType;
    }

    public void setuType(Integer uType) {
        this.uType = uType;
    }

    @Override
    public String toString() {
        return "User{" +
                "uid=" + uid +
                ", name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", sex=" + sex +
                ", birthday=" + birthday +
                ", phone='" + phone + '\'' +
                ", headPortrait='" + headPortrait + '\'' +
                ", email='" + email + '\'' +
                ", code='" + code + '\'' +
                ", status=" + status +
                ", uType=" + uType +
                '}';
    }
}
